<?php

//session_start();
//if (empty($_SESSION['username']) AND empty($_SESSION['passuser'])){
//  echo "<link href='style.css' rel='stylesheet' type='text/css'>
// <center>Untuk mengakses modul, Anda harus login <br>";
 // echo "<a href=../../index.php><b>LOGIN</b></a></center>";
//}
//else{
include "../../../config/koneksi.php";
include "../../../config/library.php";
include "../../../config/lib_fungsi.php";
include "../../../config/fungsi_seo.php";

$module=$_GET['mod'];
$act=$_GET['act'];

// Hapus berita
if ($module=='pesan' AND $act=='hapus'){
  $data=mysql_fetch_array(mysql_query("SELECT gambar FROM mahasiswa WHERE npk='$_GET[id]'"));
  if ($data['foto']!=''){
     mysql_query("DELETE FROM mahasiswa WHERE npk='$_GET[id]'");
     unlink("../../../foto_mahasiswa/$_GET[namafile]");   
 
  }
  else{
     mysql_query("DELETE FROM mahasiswa WHERE npk='$_GET[id]'");
  }
  header('location:../../dasbord.php?mod='.$module);
}

// Input mahasiswa
elseif ($module=='pesan' AND $act=='input'){
  $tgl=date('Y-m-d');
 // echo $tgl;
    mysql_query("INSERT INTO pesan (nama,
								kelas,
								email,
								komentar,
									date
										 
									  )
                          			VALUES ('$_POST[nama]',
											'$_POST[kelas]',
											'$_POST[email]',
											'$_POST[pesan]',
										'$tgl'
											)");
//echo $_POST[nama];											
header('location:../../dasbord.php?mod='.$module);
}


//}
?>
